﻿using System;
using FBSAssist;
using UnityEngine;

// Token: 0x02000592 RID: 1426
[Serializable]
public class FBSCtrlMouth : global::FBSBase
{
	// Token: 0x0600221E RID: 8734 RVA: 0x00135A30 File Offset: 0x00133C30
	public virtual float GetAdjustWidthScale()
	{
		return this.adjustWidthScale;
	}

	// Token: 0x0600221F RID: 8735 RVA: 0x00135A38 File Offset: 0x00133C38
	public new virtual void Init()
	{
		base.Init();
		this.tpcRand = new FBSAssist.TimeProgressCtrlRandom();
		this.tpcRand.Init(this.randTimeMin, this.randTimeMax);
	}

	// Token: 0x06002220 RID: 8736 RVA: 0x00135A64 File Offset: 0x00133C64
	public virtual void CalcBlend(float openValue)
	{
		this.openRate = openValue;
		base.CalculateBlendShape();
		if (this.useAjustWidthScale)
		{
			this.AdjustWidthScale();
		}
	}

	// Token: 0x06002221 RID: 8737 RVA: 0x00135A88 File Offset: 0x00133C88
	public virtual void UseAdjustWidthScale(bool useFlags)
	{
		this.useAjustWidthScale = useFlags;
	}

	// Token: 0x06002222 RID: 8738 RVA: 0x00135A94 File Offset: 0x00133C94
	public virtual bool AdjustWidthScale()
	{
		this.adjustWidthScale = 1f;
		bool flag = false;
		float num = this.tpcRand.Calculate(this.randTimeMin, this.randTimeMax);
		if (num == 1f)
		{
			this.sclStart = (this.sclNow = this.sclEnd);
			this.sclEnd = UnityEngine.Random.Range(this.randScaleMin, this.randScaleMax);
			flag = true;
		}
		if (flag)
		{
			num = 0f;
		}
		this.sclNow = Mathf.Lerp(this.sclStart, this.sclEnd, num);
		this.sclNow = Mathf.Max(0f, this.sclNow - this.openRefValue * this.openRate);
		if (0.2f < this.openRate)
		{
			this.adjustWidthScale = this.sclNow;
		}
		if (null != this.objAdjustWidthScale)
		{
			this.objAdjustWidthScale.transform.localScale = new Vector3(this.adjustWidthScale, 1f, 1f);
		}
		return true;
	}

	// Token: 0x04002A8E RID: 10894
	public bool useAjustWidthScale;

	// Token: 0x04002A8F RID: 10895
	protected FBSAssist.TimeProgressCtrlRandom tpcRand;

	// Token: 0x04002A90 RID: 10896
	public GameObject objAdjustWidthScale;

	// Token: 0x04002A91 RID: 10897
	[Range(0.01f, 1f)]
	public float randTimeMin = 0.1f;

	// Token: 0x04002A92 RID: 10898
	[Range(0.01f, 1f)]
	public float randTimeMax = 0.2f;

	// Token: 0x04002A93 RID: 10899
	[Range(0.1f, 2f)]
	public float randScaleMin = 0.65f;

	// Token: 0x04002A94 RID: 10900
	[Range(0.1f, 2f)]
	public float randScaleMax = 1f;

	// Token: 0x04002A95 RID: 10901
	[Range(0f, 1f)]
	public float openRefValue = 0.2f;

	// Token: 0x04002A96 RID: 10902
	protected float sclNow = 1f;

	// Token: 0x04002A97 RID: 10903
	protected float sclStart = 1f;

	// Token: 0x04002A98 RID: 10904
	protected float sclEnd = 1f;

	// Token: 0x04002A99 RID: 10905
	protected float adjustWidthScale = 1f;
}
